

/*============== Table hover =======================*/

var currentRowSelection = 0;

function tableRowHover(obj,action)
{
	switch(action)
	{
		case 1:
			if (obj.id != currentRowSelection)
			{
				$(obj).addClass('rowHover');
			}
		break;
		
		case 0:
			$(obj).removeClass('rowHover');
		break;
	}
}

function rowSelection(obj)
{
	$('#' + currentRowSelection).removeClass('rowSelection');
	
	if (obj.id != currentRowSelection)
	{
		$(obj).addClass('rowSelection');
		currentRowSelection = obj.id;
	} else {
		currentRowSelection = 0;
	}
	
}

/*============== DatePicker =======================*/
$(function() {
	$( "#datepicker-show" ).datepicker();
});
$(function() {
	$( "#datepicker" ).datepicker();
});	
$(function() {
	$( "#datepicker1" ).datepicker();
});
$(function() {
	$( "#datepicker2" ).datepicker();
});


/*----------Horver on Table (Cang Tin block)--------------*/
$(function(){
	$('#photoImages li').hover(function(){
			$(this).css({'background':'url(images/sprites.png) no-repeat -444px -335px', 'cursor':'pointer'});
			$(this).find('.text').css({ color:'#48c223'});
		},function(){
			$(this).css({'background':'url(images/sprites.png) no-repeat -444px -255px', 'cursor':'pointer'});
			$(this).find('.text').css({ color:'#818181'});
			});
});


/*----------Show Clock--------------*/
$(function() {
	$('#digiclock').jdigiclock();
});

/*=============== Tab ============*/
$(function() {
	$( "#tabs" ).tabs();
});


$(function() {
	$( "#tabs1" ).tabs();
});
/*============== Dialog =======================*/
$(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
	
		$( "#dialog-modal" ).dialog({
			height: 140,
			modal: true
		});
	});


/*=============== Popup Lock screen ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-lock" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-lock" ).click(function() {
		$( ".dialog-lock" ).dialog( "open" );
		return false;
	});
});

/*=============== Popup Customer ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-customer" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-customer" ).click(function() {
		$( ".dialog-customer" ).dialog( "open" );
		return false;
	});
});

/*=============== Popup Add drink ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-add-drink" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-add-drink" ).click(function() {
		$( ".dialog-add-drink" ).dialog( "open" );
		return false;
	});
});

/*=============== Popup Add Fashion ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-add-fashion" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-add-fashion" ).click(function() {
		$( ".dialog-add-fashion" ).dialog( "open" );
		return false;
	});
});

/*=============== Popup Add Fashion ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-order-play" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-order-play" ).click(function() {
		$( ".dialog-order-play" ).dialog( "open" );
		return false;
	});
});

/*=============== Popup Add notice ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-notice" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-notice" ).click(function() {
		$( ".dialog-notice" ).dialog( "open" );
		return false;
	});
});
/*=============== Popup Calculator ============*/
$.fx.speeds._default = 100;
$(function() {
	$(".dialog-calc" ).dialog({
		autoOpen: false,
		show: "blind",
		hide: "blind",
		width: 500,
		modal: true,
	});
	$( ".btn-calc" ).click(function() {
		$( ".dialog-calc" ).dialog( "open" );
		return false;
	});
});

/*============== Menu Windown - Click to dropdown =======================*/
$(document).ready(
	function() {
		jd_Menu_init();

		// Attach an event for testing purposes
		$('.jd_menu > li').click(
			function() {
				if ($('> ul', this).size() < 1) {
					alert('Clicked! [' + $(this).html() + ']');
				}
			});
	});